<template>
    <el-table :data="tableData" style="width: 100%">
    <!-- <el-table-column prop="" label="Item Id" width="180" /> -->
        <el-table-column prop="username" label="Username" width="180" />
        <el-table-column prop="itemId" label="Item Id" width="180" />
        <el-table-column prop="quantity" label="Quantity" width="180" />
        <el-table-column prop="price" label="Price" width="180" />
  </el-table>
</template>
<script lang="ts" setup>
import { useStore } from 'vuex';

const store = useStore();
const tableData = store.state.shopCart;
console.log(tableData);

// const minus = ()
</script>

 <!-- addToCart(itemId){
            var username = window.sessionStorage.getItem('username');
            var totalPrice = 0.00;
            var carts = new Array();
            axios({
            method : 'POST',
            url : "account/"+username+"/cart/"+itemId,
            params : {
                quantity : "1",
            } ,
            data : {
                id : "",
                username : "",
                itemId : "",
                quantity : "",
                price : ""
            }
        }).then(Response => {
            carts.splice(0, carts.length);
            totalPrice = 0.00;
            for(var i = 0; i < Response.data.data.length; i++)
            {
                Response.data.data[i].quantity = Number(Response.data.data[i].quantity);
                carts.push(Response.data.data[i]);
                totalPrice += Response.data.data[i].price;
            }
            window.sessionStorage.removeItem('carts');
            window.sessionStorage.setItem("carts", JSON.stringify(carts));
            window.sessionStorage.setItem("totalPrice", String(totalPrice));
            window.location.href="http://localhost:3000/cart"
            })
        } -->